#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 5e5 + 5;

int n, m;
ll t;
ll a[N], b[N];
bool check(int l, int r) {
  if (r > n) return false;
  rep(i, l, r) b[i] = a[i];
  sort(b + l, b + r + 1);
  ll res = 0;
  for (int i = 1; l < r && i <= m; i++) {
    res += (b[r] - b[l]) * (b[r] - b[l]);
    r--, l++;
  }
  return res <= t;
}
int solve() {
  cin >> n >> m >> t;
  rep(i, 1, n) cin >> a[i];
  int l = 1, cnt = 0;
  while (l <= n) {
    int p = 1, r = l;
    while (p) {
      if (check(l, r + p))
        r += p, p <<= 1;
      else
        p >>= 1;
    }
    l = r + 1;
    cnt++;
  }
  return cnt;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    cout << solve() << endl;
  }
  return 0;
}